﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace CreaMotion.Interfaces
{
    #region Classes
    //Indexes: NotInheritable 
    sealed public class Index
    {
        public String IndexName { get; set; }
        public String IndexType { get; set; }
    }

    //Fields: NotInheritable 
    sealed public class Field
    {
        public enum RType
        {
            one,
            many
        }

        public String FieldName { get; set; }
        public String FieldType_db { get; set; }
        public Type FieldType_net { get; set; }
        public String Comment { get; set; }
        public String Collation { get; set; }
        public Object DefaultValue { get; set; }
        public Int64 ValueLength { get; set; }
        public Boolean IsPrimaryKey { get; set; }
        public Boolean IsRelationship { get; set; }
        public RType RelationshipType { get; set; }
        public Boolean NotNull { get; set; }
        public List<Index> Indexes { get; set; }

        public Field()
        {
            Indexes = new List<Index>();
        }
    }

    //Tables: NotInheritable
    sealed public class Table
    {
        public String TableName { get; set; }
        public String Comment { get; set; }
        public List<Field> Fields { get; set; }
        public String Collation { get; set; }

        public Table()
        {
            Fields = new List<Field>();
        }

    }

    //Relationship: NotInheritable
    sealed public class Relationship
    {
        public String FirstTableName {get; set;}
        public String SecoundTableName {get; set;}
        public Field FirstField {get; set;}
        public Field SecoundField {get; set;}
    }

    //Database
    sealed public class Database
    {
        public String DatabaseName { get; set; }
        public String Collation { get; set; }
        public String Engine { get; set; }
        public List<Table> Tables { get; set;}
        List<Relationship> relationships = new List<Relationship>();
        public List<Relationship> Relationships
        {
            get
            {
                return relationships;
            }
            set
            {
                relationships = value;
            }
        }


        public Database()
        {
            Tables = new List<Table>();
        }

    }

    #region About
    sealed public class About
    {
        public String SupportedDatabaseSystem { get;  set; }
        public String Version { get; set; }
        public String Developer { get; set; }
        public String Description { get; set; }
    }
    #endregion
    #endregion
    
    #region IDBConnector

    public interface IDBConnector
    {

        #region Methods
            Database Connect();
            About AboutConnector();
        #endregion
    }
    
    #endregion
}
